import logging
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from pyquery import PyQuery as pq
# from mysql_db import MysqlDB
from config import local_config as config

logging.basicConfig(level=logging.INFO,
                    format='%(asctime)s - %(levelname)s: %(message)s')


class Feigua:

    def __init__(self):
        # chrome浏览器配置对象
        # 浏览器配置对象
        self.options = webdriver.ChromeOptions()
        # 禁用自动化栏
        self.options.add_experimental_option('excludeSwitches', ['enable-automation'])

        # 反爬虫特征处理
        self.options.add_argument('--disable-blink-features=AutomationControlled')
        self.options.binary_location = config.CHROME_ADDR



        self.browser = webdriver.Chrome(executable_path=config.CHROMEDRIVER_ADDR,
                                        options=self.options)
        # 全屏
        self.browser.maximize_window()
        self.wait = WebDriverWait(self.browser, config.TIMEOUT)


if __name__ == '__main__':
    chan = Feigua()
